package com.tianruan.dc.modules.sys.user.service.impl;

import com.tianruan.dc.common.utils.IdGen;
import com.tianruan.dc.modules.sys.user.mapper.BindWXMapper;
import com.tianruan.dc.modules.sys.user.service.IBindWXService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import springfox.documentation.service.ApiListing;

@Service
public class BindWXServiceImpl implements IBindWXService {

    @Autowired
    private BindWXMapper bindWXMapper;


    /**
     * 绑定微信
     * @param user_id
     * @param openid
     */
    @Override
    public void bind(String user_id,String openid) {
        try {
            String id= IdGen.uuid();
            bindWXMapper.bind(id,user_id,openid);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    @Override
    public String selectBind(String openId) {
        try{
            return bindWXMapper.selectBind(openId);
        }catch (Exception e){
            throw new RuntimeException(e);
        }
    }

}
